<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="basePath.jsp"%>
<%@ page import="java.util.*,entity.*" %> 
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<%=viewPath%>/css/lib/bootstrap.min.css" />
	<link href="<%=viewPath %>/toastr/toastr.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css"
	href="<%=viewPath%>/css/lib/bootstrap-responsive.min.css" />
<link rel="stylesheet" type="text/css"
	href="<%=viewPath%>/css/app/bootstrap-consistency.css" />
<link rel="stylesheet" type="text/css"
	href="<%=viewPath%>/css/app/submitter.css" />
<title>Create A Risk</title>
</head>
<body>
	  <%
	  User user=(User)session.getAttribute("user");
	  @SuppressWarnings("unchecked")
	  List<User> tracers=(List<User>)session.getAttribute("tracers");
	  %>
	  <div class="submit-board normal-font">
	  	<form action="<%=path %>/committer" method="post">
            <div class="content">
                <div class="input-row">
                    <span>Risk entry:</span><input name="title" type="text" class="form-control input"/>
                </div>
                <div class="input-row">
                    <span>Possibility:</span>
                    <select name="possibility" class="form-control input">
                    	<option value="High">High</option>
                    	<option value="Medium">Medium</option>
                    	<option value="Low">Low</option>
                    </select>
                </div>
                <div class="input-row">
                    <span>Influence:</span>
                    <select name="influence" class="form-control input">
                    	<option value="High">High</option>
                    	<option value="Medium">Medium</option>
                    	<option value="Low">Low</option>
                    </select>
                </div>
                <div class="input-row">
                    <span>Committer:</span><input name="committer" type="text" class="form-control input" value="<%=user.getUsername()%>" readonly />
                </div>
                <div class="input-row">
                    <span>Follower:</span><select name="tracer" class="form-control input">
                    	<%for(User tracer: tracers){ %>
                    	<option value=<%=tracer.getId() %>><%=tracer.getUsername() %></option>
                    	<%} %>
                    </select>
                </div>
            </div>
            <footer>
                <input type="submit" value="Submit" class="btn btn-primary float-right">
                <input type="button" value="Log out" class="btn btn-primary float-right" style="margin-right:10px" onclick="location.href='<%=path%>/logout'">
            </footer>
        </form>
       </div>	
       
       <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="<%=viewPath %>/js/lib/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<%=viewPath %>/bootstrap/js/bootstrap.min.js"></script>
<script src="<%=viewPath %>/toastr/toastr.min.js"></script>
<script>  
<%if(request.getAttribute("error")!=null){
	String msg=(String)request.getAttribute("error");
%>
toastr.options = {
		  "closeButton": false,
		  "debug": false,
		  "newestOnTop": false,
		  "progressBar": true,
		  "positionClass": "toast-top-right",
		  "preventDuplicates": false,
		  "onclick": null,
		  "showDuration": "300",
		  "hideDuration": "1000",
		  "timeOut": "3000",
		  "extendedTimeOut": "1000",
		  "showEasing": "swing",
		  "hideEasing": "linear",
		  "showMethod": "fadeIn",
		  "hideMethod": "fadeOut"
}
toastr.error("<%=msg%>");
<%}%>

<%if(request.getAttribute("success")!=null){
	String successMsg=(String)request.getAttribute("success");
%>
toastr.options = {
		  "closeButton": false,
		  "debug": false,
		  "newestOnTop": false,
		  "progressBar": true,
		  "positionClass": "toast-top-right",
		  "preventDuplicates": false,
		  "onclick": null,
		  "showDuration": "300",
		  "hideDuration": "1000",
		  "timeOut": "3000",
		  "extendedTimeOut": "1000",
		  "showEasing": "swing",
		  "hideEasing": "linear",
		  "showMethod": "fadeIn",
		  "hideMethod": "fadeOut"
}
toastr.success("<%=successMsg%>");
<%}%>

</script>
       
</body>
</html>